package dao

import (
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
	cfg "learn-web/common/config"

	"learn-web/models"
)

func init() {
	// mysql
	var mysqlUrl = cfg.GetString("mysql_url")
	// set default database
	orm.RegisterDriver("mysql", orm.DRMySQL)
	orm.RegisterDataBase("default", "mysql", mysqlUrl, 1, 3)

	orm.RegisterModel(new(models.User))

	// orm.Debug = true
}
